import Vue from 'vue'
import Router from 'vue-router'
import addNews from '@/components/addNews'
import newsList from '@/components/newsList'
import home from '@/components/home'
import layout from '@/components/layout'
import button from '@/components/button'
import icon from '@/components/icon'
import input from '@/components/input'
import table from '@/components/table'
import updateNews from '@/components/updateNews'
import NavMenu from '@/components/NavMenu'
import tree from '@/components/tree'
import upload from '@/components/upload'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/home',
      name: 'home',
      component: home,
      redirect:"/newsList",
      children:[
        {
          path: '/addNews',
          name: 'addNews',
          component: addNews
        },
        {
          path: '/newsList',
          name: 'newsList',
          component: newsList
        },
        {
          path: '/updateNews/:news?',
          name: 'updateNews',
          component: updateNews
        },
        {
          path:"/button",
          name:"button",
          component:button
        }
      ]
    },
    {
      path:"/layout",
      name:"layout",
      component:layout
    },
    {
      path:"/icon",
      name:"icon",
      component:icon
    },
    {
      path:"/input",
      name:"input",
      component:input
    },
    {
      path:"/table",
      name:"table",
      component:table
    },
    {
      path:"/NavMenu",
      name:"NavMenu",
      component:NavMenu
    },
    {
      path:"/tree",
      name:"tree",
      component:tree
    },
    {
      path:"/upload",
      name:"upload",
      component:upload
    }
  ]
})
